import request from "../utils/request";
import { DefaultParams, SignInData } from "./types";

// 子任务查询接口
export const getSignIn = (data: SignInData) => {
  return request({
    url: "/appGameTask/appSub",
    method: "post",
    data,
  });
};

// 完成任务接口
export const completeTask = (data: SignInData) => {
  return request({
    url: "/appGameTaskRecord/signIn",
    method: "post",
    data,
  });
};

// 任务列表接口
export const getTaskList = (studentId: string) => {
  return request({
    url: `/appGameTask/app/${studentId}`,
    method: "get",
  });
};

// 学生轨迹历史记录
export const getStudentTrack = (data: any) => {
  return request({
    url: "/aiSchoolStudentAction/queryTrajectory",
    method: "post",
    data,
  });
};

// 日记列表
export const getDiaryList = (month: string, studentId: string) => {
  return request({
    url: `/appStudent/signInList/${month}/${studentId}`,
    method: "get",
  });
};

// 等级字典表
export const getGradeList = () => {
  return request({
    url: "/rankAll",
    method: "get",
  });
};

// 好友查找
export const queryFriend = (data: DefaultParams) => {
  return request({
    url: "/appGameStudentFriend/queryPage",
    method: "post",
    data,
  });
};

// 路由地址查询
export const getQueryPage = (data: DefaultParams) => {
  return request({
    url: "/appGameNavigation/queryPage",
    method: "post",
    data,
  });
};

export const getDayOffData = (month: string) => {
  return request({
    url: `/appStudent/Holiday/${month}`,
    method: "get",
  });
};

// 日记签到
export const postSignIn = (data: { studentId: string; signInDate: string }) => {
  return request({
    url: "/appStudent/signIn",
    method: "post",
    data,
  });
};

// 日记详情
export const getDiaryDetails = (data: {
  studentId: string;
  occurTime: string;
  schoolId: string;
}) => {
  return request({
    url: `/aiSchoolStudentAction/diaryInfo`,
    method: "post",
    data,
  });
};

// 我的详情
export const getMyDetails = (studentId: string) => {
  return request({
    url: `/myInfo/${studentId}`,
    method: "get",
  });
};

// 同班同学查询
export const getClassmateList = (data: DefaultParams) => {
  return request({
    url: "/appGameStudentFriend/queryComradePage",
    method: "post",
    data,
  });
};

// 好友申请查询
export const getFriendApplyList = (data: DefaultParams) => {
  return request({
    url: "/appGameStudentFriend/queryApplyPage",
    method: "post",
    data,
  });
};

// 同意添加好友
export const postAgreeFriend = (id: string) => {
  return request({
    url: `/appGameStudentFriend/agree/${id}`,
    method: "get",
  });
};

// 拒绝添加好友
export const postRefuseFriend = (id: string) => {
  return request({
    url: `/appGameStudentFriend/disagree/${id}`,
    method: "get",
  });
};

// 发送好友申请
export const postSendFriendApply = (data: {
  studentId: string;
  friendId: string;
}) => {
  return request({
    url: "/appGameStudentFriend/add",
    method: "post",
    data,
  });
};

export const postUserInfo = (data: any) => {
  return request({
    url: "/appAndHtml/register",
    method: "post",
    data,
  });
};

export const getCaptcha = () => {
  return request({
    url: "/appAndHtml/getCaptcha/13857121166",
    method: "get",
  });
};

// 获取未读信息
export const getUnreadMsg = (studentId: string) => {
  return request({
    url: `/appGameStudentFriend/unread/${studentId}`,
    method: "get",
  });
};

// 好友查询
export const getFriendList = (data: {
  studentId: string;
  idNumber: string;
}) => {
  return request({
    url: `/appGameStudentFriend/search`,
    method: "post",
    data,
  });
};

export const getMyData = () => {
  return request({
    url: `/appUser/getMy`,
    method: "get",
  });
};

export const getTaskCoDetails = (taskId: string) => {
  return request({
    url: `/appGameTaskRecord/taskDetails/${taskId}`,
    method: "get",
  });
};

export const taskReceive = (data: any) => {
  return request({
    url: `/appGameTaskRecord/receive`,
    method: "post",
    data,
  });
};

export const completeTaskCo = (data: any) => {
  return request({
    url: `/appGameTaskRecord/completeSub`,
    method: "post",
    data,
  });
};
